# -*- encoding: utf-8 -*- 
from itertools import groupby
from datetime import datetime, timedelta
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.tools import float_is_zero, float_compare, DEFAULT_SERVER_DATETIME_FORMAT
from odoo.tools.misc import formatLang
import odoo.addons.decimal_precision as dp
class fhcode_tb_modle(models.Model):
    _name = 'fhcode.tb_modle'
    _description = u'模块'
    _rec_name='fname'
    _order='create_date DESC'	
    def get_employee(self):
        obj = self.env['hr.employee']
        idsobj = obj.search([('user_id','=',self.env.user.id)])
        print('-------------------------------------')		
        print(self.env.user.id)		
        #print(ids)	
        res = idsobj.read()
        print(res)					
        return res and res[0]['id'] or 0
    fname= fields.Char(u'模块名',readonly=False,required=False,translate=False)
    fzuozhe= fields.Char(u'作者',readonly=False,required=False,translate=False)
	
    fyilai= fields.Char(u'依赖项',readonly=False,required=False,translate=False)	
	
    fpath= fields.Char(u'生成路径',readonly=False,required=False,translate=False)	
    fpath2= fields.Char(u'fhcode路径',readonly=False,required=False,translate=False)	
    ftext=fields.Text(u'描述',readonly=False,required=False,translate=False)
    order_line = fields.Many2many("fhcode.tb_table002", 'fhcode_modle_table002_rel', 'uid', 'gid', string=u'基本表',)





		
    @api.model		
    def action_funproved0(self):
        #context = context or {}
        t=fields.datetime.now()
        #huid=self.get_employee(cr,uid,context)
        self.write({'state':'wait_prove','FAdddate':t})       
        return True
		
    @api.model		
    def action_funproved(self):
        #context = context or {}
        t=fields.datetime.now()
        #huid=self.get_employee(cr,uid,context)
        self.write({'state':'proved','FAdddate':t})       
        return True		
    @api.model		
    def create(self, vals):
        result = super(fhcode_tb_modle, self).create(vals)	
        return result
    @api.multi		
    def write(self, values):
	    
        result = super(fhcode_tb_modle, self).write(values)		
		
        return result
    @api.multi
    def unlink(self):
	
        return super(fhcode_tb_modle, self).unlink()
    @api.multi
    def copy(self, default=None):
        return super(fhcode_tb_modle, self).copy(default)
    @api.multi
    def search(self, args, offset=0, limit=None, order=None, context=None, count=False):
        domain =None		
        domain = [('state', '=', '0')]		
        return super(fhcode_tb_modle, self).search(args, offset=offset, limit=limit, order=order, count=count)
		
fhcode_tb_modle() #对象定义结束
